package com.xxwy.ddu.common.autowired.email;

import org.springframework.amqp.rabbit.annotation.EnableRabbit;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;


/**
 * @author xxwy
 * on 2018/8/9 0009
 * 采用Rabbitmq实现异步发送邮件，默认没有开启
 * 监听队列：
 * 简单：xxwy.ddu.mail.simple
 * html: xxwy.ddu.mail.html
 * 附件：xxwy.ddu.mail.attachment
 */
@EnableRabbit
@Component
public class EmailServicePlusImpl extends EmailServiceImpl implements EmailService {

    /**
     * 可以配置全局fromEmail，mail.fromEmail
     * 发送简单信息
     */
    @Override
    @RabbitListener(queues = "xxwy.ddu.mail.simple")
    public void sendSimpleMail(EmailInfo info) {
        super.sendSimpleMail(info);
    }

    /**
     * 发送Html信息
     *
     * @param info
     */
    @Override
    @RabbitListener(queues = "xxwy.ddu.mail.html")
    public void sendHtmlMail(EmailInfo info) {
       super.sendHtmlMail(info);
    }

    /**
     * 发送附件,牵扯文件的上传，着不好写唉，先不写
     */
    @Override
    @RabbitListener(queues = "xxwy.ddu.mail.attachment")
    public void sendAttachmentMail(EmailInfo info) {
        super.sendAttachmentMail(info);
    }
}
